package com.pb.b2b.bean;

import java.io.Serializable;

import javax.faces.application.FacesMessage;

import com.pb.b2b.util.FacesUtils;

public abstract class BaseBean implements Serializable {
	private static final long serialVersionUID = 1L;

	protected final String RETURN_SUCCESS = "success";
	protected final String RETURN_ERROR = "error";
	protected final String RETURN_CANCEL = "cancel";
	protected final String RETURN_BACK = "back";

	public boolean hasError() {
		if (FacesUtils.flashGet("error") != null) {
			FacesUtils.addMessage(FacesMessage.SEVERITY_ERROR, "ERROR_SYSTEM");
			return true;
		}
		return false;
	}

	public abstract String executeAction();

	public abstract String confirmAction();

	// public abstract String confirmAction();

	public String backAction() {
		return RETURN_BACK;
	}

	public String cancelAction() {
		return RETURN_CANCEL;
	}
}
